package com.pengcheng.hngateway;

import com.pengcheng.hngateway.server.TcpServer;
import com.pengcheng.hngateway.service.DbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
public class MyApplication implements CommandLineRunner {
    @Autowired
    private TcpServer server;
    @Autowired
    private DbService dbService;
    public static void main(String[] args)
    {
        SpringApplication.run(MyApplication.class,args);
    }

    @Override
    public void run(String... args) throws Exception {
        String sql1="update hnww_device set state=0 where deleted=0";
        dbService.jdbcTemplate.update(sql1);
        server.bind();
    }
}
